/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package agents;

import env.Action;
import env.Orientation;
import java.awt.Color;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import search2.Agent2;
import search2.MyQueue;

/**
 *
 * @author user
 */
public class Agent2glue extends Agent{
    static Icon iconNorth = new ImageIcon("images/ShipNorth.gif");
    static Icon iconSouth = new ImageIcon("images/ShipSouth.GIF");
    static Icon iconEast = new ImageIcon("images/ShipEast.GIF");
    static Icon iconWest = new ImageIcon("images/ShipWest.GIF");
    
    Agent2 me;
    
    public Agent2glue(String name, int row, int col, Orientation orientation, Color color, MyQueue queue) {
        super(name, row, col, orientation, color);
        me=new Agent2(name, row, col, orientation, queue);
    }
    
    @Override
    public Action getMove() {
        return me.getMove();
    }

    @Override
    public Icon getIcon() {
        switch(this.getOrientation()) {
            case North: return iconNorth;
            case East: return iconEast;
            case West: return iconWest;
            case South: return iconSouth;
        }
        return null;
    }
    
    @Override
    public void moveFailed() {
        System.out.println(getName()+ " is stuck! replanning...");
        me.rePlan();
//        search.rePlan();
//        try {
//                System.in.read();
//            } catch (IOException ex) {
//                Logger.getLogger(SmartAgent.class.getName()).log(Level.SEVERE, null, ex);
//            }
    }

}
